package main.Q2501_2600;

public class Q2571_2580 {
	public static void main(String[] args) {
		System.out.println("Question2571：");
		System.out.println("Question2572：");
		System.out.println("Question2573：");
		System.out.println("Question2574：左右元素和的差值");
		System.out.println("Question2575：");
		System.out.println("Question2576：");
		System.out.println("Question2577：");
		System.out.println("Question2578：");
		System.out.println("Question2579：");
		System.out.println("Question2580：");
	}
}

class Question2574 {
	public int[] leftRightDifference(int[] nums) {
		int[] result = new int[nums.length], leftSum = new int[nums.length], rightSum = new int[nums.length];
		int left = 0, right = 0;
		for (int i = 0; i < nums.length; i++) {
			leftSum[i] = left;
			rightSum[nums.length - 1 - i] = right;
			left += nums[i];
			right += nums[nums.length - 1 - i];
		}
		for (int i = 0; i < nums.length; i++) {
			result[i] = Math.abs(leftSum[i] - rightSum[i]);
		}
		return result;
	}
}